Component Genrator
Component Generator for Delphi™ 16bit

Component Generator is a simple but very effective tool to turn visually designed Delphi forms into TPanel based visual components. It will scan the .DFM and .PAS files that contain the description and underlying code  for the form, and ( after allowing the user some modifications) will create a single .PAS code file, that can be compiled into an installable Delphi component.

Legal Matters

How to use

Limitations

Files in the Distribution

Component Registration Utility

Software and documentation: Copyright 1997, Gyorgy Szaszvarosi. All rights reserved.

All mentioned trademarks are properties of their respective owners.


Use of Component Generator

Component Generator's user interface is based upon the Tabbed Notebook

metaphor. Here is the description of the pages and their contents.

Commands: the main control page

Properties : a list of all the properties of the component selected in the TreeView.

Source : displays the .PAS file belonging to the laoded .DFM file.

Published Properties: displays a list of published subcomponent properties.

Result: You may view and modify the result of the conversion.


License Agreement
Component Generator End User License Agreement

LICENSE

Component Generator (Software) is and remains the intellectual property of its Author who hereby grants you a non-exclusive license to the use of the Software, without demands of any further dues (royalties). The Software is protected by copyright laws and treaties. Title and related rights in the content accessed through the Software is the property of the applicable content owner and may be protected by applicable law. This License gives you no rights to such content.

BY USING IT, YOU ARE CONSENTING TO BE BOUND BY THIS AGREEMENT. IF YOU DO NOT AGREE TO ALL OF THE TERMS OF THIS AGREEMENT, YOU ARE REQUIRED TO RETURN THE SOFTWARE TO THE PLACE OF OBTAINING.IT, FOR A REFUND (MERCHANT MAY HAVE CERTAIN RESTRICTIONS ON RETURNS, AUTHOR DOES NOT ACCEPT ANY LIABILITIES REGARDING THAT) OR DESTROY ALL COPIES IN YOUR POSSESSION.

DISCLAIMER OF WARRANTY. Software is provided on an "AS IS" basis, without warranty of any kind, including without limitation the warranties of merchantability, fitness for a particular purpose and non-infringement. The entire risk as to the quality and performance of the Software is borne by you. Should the Software prove defective, you and not Author assume the entire cost of any service and repair. In addition you must determine that the Software sufficiently meets your requirements. This disclaimer of warranty constitutes an essential part of the agreement. SOME JURISDICTIONS DO NOT ALLOW EXCLUSIONS OF AN IMPLIED WARRANTY, SO THIS DISCLAIMER MAY NOT APPLY TO YOU AND YOU MAY HAVE OTHER LEGAL RIGHTS THAT VARY BY JURISDICTION.

UNDER THIS LICENSE you may:

· use the Software on one or more computers;

· use the Software on a network, provided that each person accessing the Software through the network must have a copy licensed to that person

· copy the Software for archival purposes, provided any copy must contain all of the original Software's proprietary notices.

You may not:

· permit other individuals to use the Software except under the terms listed above;

· modify, translate, reverse engineer, decompile, disassemble (except to the extent applicable laws specifically prohibit such restriction), or create derivative works based on the Software;

· rent, lease, grant a security interest in, or otherwise transfer rights to the Software; or

· remove any proprietary notices or labels on the Software.

TERMINATION. The license will terminate automatically if you fail to comply with the limitations described herein. On termination, you must destroy all copies of the Software.

LIMITATION OF LIABILITY. UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, TORT, CONTRACT, OR OTHERWISE, SHALL AUTHOR OR ITS SUPPLIERS OR RESELLERS BE LIABLE TO YOU OR ANY OTHER PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER  INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES. IN NO EVENT WILL AUTHOR BE LIABLE FOR ANY DAMAGES IN EXCESS OF THE AMOUNT AUTHOR RECEIVED FROM YOU FOR A LICENSE TO THE SOFTWARE, EVEN IF AUTHOR SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. FURTHERMORE, SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS LIMITATION AND EXCLUSION MAY NOT APPLY TO YOU.

HIGH RISK ACTIVITIES. The Software is not fault-tolerant and is not designed, manufactured or intended for use or resale as on-line control equipment in hazardous environments requiring fail-safe performance, such as in the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, direct life support machines, or weapons systems, in which the failure of the Software could lead directly to death, personal injury, or severe physical or environmental damage ("High Risk Activities"). Ipswitch and its suppliers specifically disclaim any express or implied warranty of fitness for High Risk Activities.

MISCELLANEOUS. If the copy of the Software you received was accompanied by a printed or other form of "hard-copy" End User License Agreement whose terms vary from this Agreement, then the hard-copy End User License Agreement governs your use of the Software. This Agreement represents the complete agreement concerning this license and may amended only by a writing executed by both parties. If any provision of this Agreement is held to be unenforceable,  such provision shall be reformed only to the extent necessary to make it enforceable.


Commands Page

Project Controls: select and initialize source for you component.

Select Source: select a .DFM file to use as the base of the conversion. (the accompanying .PAS file MUST be in the same folder)

Scan Source: the initial scan of the .DFM file (will build a hierarchical data structure, displayed in the TreeView, also reads the .PAS file into the Source page.)

Manage Project: Save and Restore the current state of project

Save Project: Saves the following information into a file: Source Path, Published Properties  the unit and component name.

Load Project: Restores the state to the saved one.

Clear Project: Clears the project, resets the programs state to that of after startup.

Help: displays this help file.

About: displays the About Box.

Exit: Exits.

Component Generation:

Component Name: enter the desired name of the component you wish to generate. (it will automatically assign a default unit name too, upon leaving the edit field).

Unit Name: assign a name for the component unit (no .PAS extension). If the Component name field is empty, it will assign that one too, upon leaving the edit field.

Generate Component: start the conversion. (it is disabled as long as the Component Name & Unit Name fields are empty)

Save Generated Source: only enabled after the Conversion is finished. Lets you select directory where you want to save your new .PAS file.


The Properties Page

The properties Page displays all the available properties, their types and values (if not the default) for the currently selected component (or sub-component). You may select some of these properties to be published for the generated component.

The Publish! Button will add the currently selected property to the "Published Properties" list, or simply double-click on the property you desire to publish. Yjis function is disabled when the Form component (the root) is selected, as by Delphis inheritance rules, all its pulished properties will be published anyway.


The Source Page

The source page allows you to view, and modify the Pascal source of the form you try to convert. It is simply a MultiLine edit field, containing the .PAS source file of the selected source form. You may make modifications, but those will not be saved with the project.

When generating your component, the current text in this page will be used for source.

If you want to undo your changes, you need to re-scan the source form. (Commands Page, Scan Source button).


Published Properties page

Displays a list of properties that you wish to be published from the generated component. The five columns of the grid describe:

Property Name: the name of the generated property

Type: The Pascal data type of the property

Value: The default value that it will be set to at Creation Time.

Comp: The name of the child component of which the property belongs to.

Name: The name of the property in the Source code of the Form.

You may modify the first (Property name) and the third (Value) coulmns by double-clicking on them, and then typing in the new value. (Be careful, as the program does not check for duplicate names, or invalid values. When entering String type values, do not use s).

When generating the component each of these rows will generate a

- property declaration in the published section

- a getXXX function in the private section

- a setXXX function in the private section

- an initialization line in the Create constructor.

The UnPublish: button removes the selected entry from the list.


Limitations of Component Generator

As I did not want to go into developing a full-fledged Pascal Parser, the conversion process assumes certain coding conventions in order to modify your source code:

- Each command line is on its own line

- begin, end, and all compound statement generating lines are on their own lines. {}, (**), and // style comments are handled..

In general, it assumes the style that Delphi follows when generating its code.

Currently most of the standard components that ship with Delphi are registered in the Classes DataBase (meaning: those components can be used in creating your own.) Except the following:

 - Data Access,

 - Data Control,

 - Internet Component,

 - Dialogs and the

 - VBE components.

You may register your own commponents with the supplied utility.


Files in the Distribution

Component Generators distribution is very simple. In addition to the program file itself, it contains:

CGEN_D16.HLP - this help file

CLASS.CLS - Class DataBase file

README.TXT - The End User License Agreement, and other up-to-date information

REGUTIL\MAIN.DFM

REGUTIL\MAIN.PAS

REGUTIL\REGCOMP.DPR

REGUTIL\REGUTIL.DCU - Component Registartion Utility files.

When first run, it will create the COMPGEN.INI file in the Windows directory, where it stores the name and path for the class database file.


The Component Registration Utility

In order to keep Component Generator as flexible as possible, information on components and their properties is stored in the CLASS.CLS file in the same directory as the progam file itself. However, at distribution time, it only contains standard Delphi components. (see Limitations).

If you want to use Component Geenerator with components of your own (or other ones acquired), you need to let the program know what it can expect from those components. In other words, you need to use the Component Registration Utility.

The component registration utility is distributed as a Delphi project. To use it, you must launch Delphi, and load the project REGCOMP.DPR.

Open up the Main Form, and place the component(s) you wish to register on the Panle below the label Place components below. It does not matter what the property values are set to, as the register only stores the property name and Type.

After that, compile and run the project.

Click on the Register Components button, and that should take care of the whole process. As the registration progresses, on the right side of the main window, in the listbox, youll see the messages xxxx successfully registered .

At the end of the process, the utility ALWAYS registers the TForm component. (BTW: the utility will not re-register already registered component types - although the message appears, they are skipped.)

IMPORTANT: the COMPGEN.INI file must exist in the Windows directory and the ClassFile_D16 entry must point to the CLASS.CLS file in order to the utility to function. (Component Generator will Create this entry on its first run)


The CLASS.CLS file

This is the main information file of Component Generator. It is located in the program folder and it contains information on alll the registered components and their properties, and also some conversion equivalences.

The CLASS.CLS file is in the Windows INI format. Every registered component has its own section. It is strongly advised not to change those entries, as Component Generator believes this file fully - no questions asked - so you may sidetrack it greatly.

Currently the only other section is called [StringTypes]. It lists all Delphi data types that can appear as properties and are assignment compatible with the type String. These values are used by the Generator, to make sure that the appropriate constant values are enclosed between s.

You may add your own String-equivalent types via any ASCII text editor. The value after the name must be s.